export default [
  { path: '/', redirect: '/home' },
  { path: '/home', component: () => import('@/pages/Home/home.vue') },
  { path: '/login', component: () => import('@/pages/Login') },
  { path: '/register', component: () => import('@/pages/Login') },
  { path: '/search/:keyword?', name: 'search', component: () => import('@/pages/Search'), meta: { show: true } },
  { path: '/detail/:skuId', name: 'detail', meta: { show: true }, component: () => import('@/pages/Detail') },
  { path: '/AddCartSuccess', name: 'AddCartSuccess', meta: { show: true }, component: () => import('@/pages/AddCartSuccess') },
  { path: '/shopCart', name: 'shopCart', meta: { show: true }, component: () => import('@/pages/ShopCart') },
  {
    path: '/trade',
    name: 'trade',
    meta: { show: true },
    component: () => import('@/pages/Trade'),
    // 导航独享守卫
    beforeEnter: (to, from, next) => {
      if (from.path == '/shopCart') return next()
      next(false)
    }
  },
  {
    path: '/pay',
    name: 'pay',
    meta: { show: true },
    component: () => import('@/pages/Pay'),
    beforeEnter: (to, from, next) => {
      if (from.path == '/trade') return next()
      next(false)
    }
  },
  {
    path: '/paysuccess',
    name: 'paysuccess',
    meta: { show: true },
    component: () => import('@/pages/PaySuccess'),
    beforeEnter: (to, from, next) => {
      if (from.path == '/pay') return next()
      next(false)
    }
  },
  {
    path: '/center',
    meta: { show: true },
    component: () => import('@/pages/Center'),
    children: [
      { path: '/center', redirect: '/center/myorder' },
      { path: 'myorder', component: () => import('@/pages/Center/myOrder') },
      { path: 'grouporder', component: () => import('@/pages/Center/groupOrder') }
    ]
  }
]
